#pragma once


//il numero delle righe e delle colonne
static const short N_ROW   = 6;
static const short N_ROW_U = N_ROW-1;
static const short N_COL = 7;

typedef enum{ RIGHT = 1 , LEFT = -1} Versus_t;
typedef enum{ YELLOW = 1, RED = 2, BLACK = 0} Color_t;
#define OPPOSITE_COLOR(c) (c == YELLOW ?  RED : YELLOW)
//#include"stdafx.h"
	struct  Point
{ 
public:
  short x,y;
  Color_t color;  
  void setvalues(short _x,short _y,Color_t _color){x=_x,y=_y,color =_color;}
} ;


class Grid
{
public:
	Grid (void)							  { Reset();}
	~Grid(void)							  { };
	Point  GetWinner()                    { return m_pWinPoint; }
	void   ExtractCoin (short col);
	bool   IsFullColumn(short i)          { return (m_sGridCounter[i] == N_ROW_U);}
	Point  FindWinner(void);    
	short  InsertCoin(Color_t enCoinCol, short col);       
	void   Reset();
	void   Trace();
	
private:
	Color_t m_sGrid[N_ROW][N_COL];  //griglia con lo stato attuale  della partita
	short   m_sGridCounter[N_COL];
	Point   m_pWinPoint;
};

template<int i,int j,short *grid>
class LOOP
{
	enum { result = (r > 0)? FindWinner(grid) : LOOP<i-1,j>::result };
	
	static FindWinner(short *grid)
	{
	
	
	
	}
};

template< T g>
class LOOP<0,r>
{
	enum {result = g.FindWinner() };
};